Skip to content

fix: address security vulnerabilities in webhooks plugin #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 18, 2025

Conversation

josephfusco
Copy link
Member

@josephfusco josephfusco commented Jul 11, 2025

This pull request introduces security enhancements and debugging improvements to the wp-graphql-webhooks plugin. Key changes include improved input/output sanitization, stricter authorization checks, conditional logging for debugging, and adjustments to ensure sensitive information is not exposed in logs.

Copy link

changeset-bot bot commented Jul 11, 2025

🦋 Changeset detected

Latest commit: cff50ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wpengine/wpgraphql-webhooks-wordpress-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

github-actions bot commented Jul 11, 2025

ℹ️ Download the latest wp-graphql-webhooks plugin zip from this PR
(See the 'Artifacts' section at the bottom)

@github-project-automation github-project-automation bot moved this to 🆕 Backlog in Headless OSS Jul 14, 2025
@josephfusco josephfusco marked this pull request as ready for review July 15, 2025 14:06
@josephfusco josephfusco requested a review from a team as a code owner July 15, 2025 14:06
@josephfusco josephfusco requested review from theodesp and Copilot July 15, 2025 14:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR strengthens security in the wp-graphql-webhooks plugin by sanitizing inputs/outputs, tightening authorization checks, and ensuring sensitive data isn’t logged by default.

  • Added esc_html and proper sanitization functions to exception messages, nonces, and user inputs
  • Wrapped debug logs in WP_DEBUG checks and removed sensitive URL/headers from default logs
  • Replaced capability checks and nonce verifications for admin actions

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
plugins/wp-graphql-webhooks/src/Services/PluginServiceLocator.php Escape exception messages with esc_html to prevent HTML injection
plugins/wp-graphql-webhooks/src/Rest/WebhookTestEndpoint.php Conditional debug logging, redact sensitive URL/headers, and static triggered_by
plugins/wp-graphql-webhooks/src/Handlers/WebhookHandler.php Wrapped dispatch logs in WP_DEBUG checks, but still logs sensitive URL/headers
plugins/wp-graphql-webhooks/src/Events/SmartCacheWebhookManager.php Added debug log guard and switched from parse_url to wp_parse_url
plugins/wp-graphql-webhooks/src/Admin/WebhooksListTable.php Sanitized orderby/order, escaped nonces, and outputs for bulk actions
plugins/wp-graphql-webhooks/src/Admin/WebhooksAdmin.php Improved nonce unslashing, but replaced capability check with only nonce verification
.changeset/spotty-mice-behave.md Added changelog entries for security hardening

@josephfusco josephfusco enabled auto-merge July 18, 2025 13:54
@josephfusco josephfusco added this pull request to the merge queue Jul 18, 2025
Merged via the queue into main with commit 8a9be18 Jul 18, 2025
9 checks passed
@josephfusco josephfusco deleted the webhooks-plugin-security-review branch July 18, 2025 13:55
@github-project-automation github-project-automation bot moved this from 🆕 Backlog to ✅ Closed in Headless OSS Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Closed
Development

Successfully merging this pull request may close these issues.

2 participants